﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RaiderManagerBackend
{
    public class Encounter
    {
        private string _bossName;
        private List<PlayerPerformanceEntry> _performanceEntries = new List<PlayerPerformanceEntry>();
        private int _encounterId;
        private Raid _raid;
        private string _location;

        public Encounter(Raid raid)
        {
            Raid = raid;
        }

        public string BossName
        {
            get { return _bossName; }
            set { _bossName = value; }
        }

        public string Location
        {
            get { return _location; }
            set { _location = value; }
        }

        public List<PlayerPerformanceEntry> PerformanceEntries
        {
            get { return _performanceEntries; }
        }

        public int EncounterId
        {
            get { return _encounterId; }
            private set { _encounterId = value; }
        }

        public Raid Raid
        {
            get { return _raid; }
            set { _raid = value; }
        }

        public void SaveEncounter()
        {
            //saves encounter to Database;
            SQLiteCommunicator comm = new SQLiteCommunicator();
            comm.AddUpdateEncounter(this);
            //save all of the PlayerPerformanceEntires for this encounter;
            foreach (PlayerPerformanceEntry ppe in PerformanceEntries)
            {
                ppe.SavePerformanceEntry();
            }
        }
    
    }
}
